<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="no-referrer" />
    <title>手动编辑已存在的航线</title>
    <style>
        body {
            position: absolute;
            margin: 0;
            width: 100%;
            height: 100%;
        }

        #mapContainer {
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            float: left;
        }
    </style>
</head>

<body>

    <div id="mapContainer" style="position: relative;">
    </div>

</body>
<script src='/GiswayEngine.js'></script>
<script type="text/javascript">

    var shapeObject;
    var merge = true;
    window.app = new GE.App('mapContainer', {
        // position: [120.0111296944484, 30.242285403905438, 2000],
        // lookAt: [120.0111296944484, 30.242285403905438, 0],

        // position: [119.5562042355, 29.3448076791, 3000],
        // lookAt: [119.5562042355, 29.3448076791, 0],

        position: [118.8199342908355, 31.946370313786982, 500],
        lookAt: [118.8199342908355, 31.946370313786982, 0], 

        cameraScrollSpeed: 15,
        minZoom: 3,
        maxZoom: 23,
        ambientLightIntensity: 3,
        ambientLightType: 'hemiSphere',
        useCarpet: true,
        background: "Fog", //添加shp文件或矢量底图的背景应尽量选用雾模式
        useDefaultTexture: true, //是否使用瓦片默认纹理
        baseLayer: [
            {
                url: ' https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
                readableUrl: true,
                tileType: 'image',
            },
        ]
    });

    shp();

    function shp() {
        shapeObject = new GE.ShapeObject({
            // url: 'http://192.168.2.100:8702/resources/1b8b2fcb26b020120aebfac57779e06a/shp/yuhang.shp',
            // url: 'http://localhost:9000/examples/resources/shp/范围框/居民地.shp',
            url: 'http://localhost:9009/examples/resources/shape/20250414_90米高房屋面数据/20250414_90米高房屋面数据/转84/90米以上的房屋面.shp',
            // url: 'http://localhost:9009/examples/resources/shape/20250414_90米高房屋面数据/20250414_90米高房屋面数据/转84/依比例尺电塔.shp',
            //C:\workspace\webglengin\examples\resources\shape\南京市\南京市矢量数据\南京市矢量数据\南京建筑轮廓数据\南京建筑轮廓数据
            // url: 'http://localhost:9009/examples/resources/shape/南京市/南京市矢量数据/南京市矢量数据/南京建筑轮廓数据/南京建筑轮廓数据/南京.shp',
            //C:\workspace\webglengin\examples\resources\shape\南京市\南京建筑数据1\南京建筑轮廓数据
            // url: 'http://localhost:9009/examples/resources/shape/南京市/南京建筑数据1/南京建筑轮廓数据/南京.shp',
            //C:\workspace\webglengin\examples\resources\shape\南京市\Nanjing建筑轮廓2
            // url: 'http://localhost:9009/examples/resources/shape/南京市/Nanjing建筑轮廓2/Nanjing.shp',
            merge: merge, //此参数设置为true后会大幅提升性能但是无法单体化
            // heightField: 'high', //shp中代表建筑高度的字段
            heightField: 'RoofElev', //shp中代表建筑高度的字段
        });
        app.add(shapeObject);

        if (!merge) {
            app.on('Click', function (event) {
                //shpProperty中存储了shp文件中对象的属性
                if (event.objs.object.shpProperty) {
                    console.log(event.objs.object.shpProperty);
                }
            })
        }
    }

    var editRoute;
    function setRoute(){
        let lineData = {
            pointArray: [new GE.Point(118.81975614374024, 31.948842176214992, 50, '4326'), new GE.Point(118.82027784243675, 31.946646648624682, 50, '4326')],  //多边形的顶点数组
            color: '#00FA9A',
            lineWidth: 5,  //线的宽度
            depthTest: true
        };
        let polyline = new GE.Polyline(lineData);

        editRoute = new GE.EditRoute({realLine: polyline});
        editRoute.initRouteSign();
        editRoute.startEdit();
    }
    setRoute();

    // window.app.on('Click', function (e) {
    //     console.log(e);
    // });

</script>

</html>